package edu.univercidade.tcc.server.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;

import edu.univercidade.tcc.server.model.Issue;
import edu.univercidade.tcc.server.model.Project;
import edu.univercidade.tcc.server.model.ProjectMember;


public class MembershipServiceImpl implements MembershipService {

	@Override
	public List<ProjectMember> findProjectMemberByProject(Project project) {
		EntityManager em = Issue.entityManager();
		TypedQuery<ProjectMember> q = em.createQuery("SELECT m.member FROM Membership m WHERE m.project = :project", ProjectMember.class);
		q.setParameter("project", project);
		return q.getResultList();
	}
}
